package com.bwie.gddproject.index.precenter;

import com.bwie.gddproject.index.model.bean.Classify2Bean;
import com.bwie.gddproject.index.model.ClassifyModel;
import com.bwie.gddproject.index.model.IClassifyModel;
import com.bwie.gddproject.index.model.bean.VpBean;
import com.bwie.gddproject.index.view.fragment.IClassifyFragment;
import com.bwie.gddproject.net.OnNetLitenner;

/**
 * Created by 我走路带风 on 2017/12/16.
 */

public class ClassifyPrecenter implements IClassifyPrecenter{
    private IClassifyModel classifyModel;
    private IClassifyFragment classifyFragment;

    public ClassifyPrecenter(IClassifyFragment classifyFragment) {
        classifyModel = new ClassifyModel();
        this.classifyFragment = classifyFragment;
    }

    @Override
    public void getVpData() {
        classifyModel.getClassify1(new OnNetLitenner<VpBean>() {
            @Override
            public void success(VpBean vpBean) {
                classifyFragment.showClassify1(vpBean);
            }

            @Override
            public void fail(String errer) {
                classifyFragment.toast(errer);
            }
        });
    }

    @Override
    public void getVpData2(String cid) {
        classifyModel.getClassify2(new OnNetLitenner<Classify2Bean>() {
            @Override
            public void success(Classify2Bean classify2Bean) {
                classifyFragment.showClassify2(classify2Bean);
            }

            @Override
            public void fail(String errer) {
                classifyFragment.toast(errer);
            }
        },cid);
    }
}
